import Router from '@koa/router';
import OssConfigController from '@/controllers/OssConfigController';
import auth from '@/middlewares/auth';

const router = new Router({
  prefix: '/api/oss-configs',
});

// 所有路由都需要认证
router.use(auth);

/**
 * @route   GET /api/oss-configs
 * @desc    获取OSS配置列表
 * @access  Private
 */
router.get('/', OssConfigController.list);

/**
 * @route   GET /api/oss-configs/default
 * @desc    获取默认配置
 * @access  Private
 */
router.get('/default', OssConfigController.getDefault);

/**
 * @route   GET /api/oss-configs/:id
 * @desc    获取单个OSS配置
 * @access  Private
 */
router.get('/:id', OssConfigController.get);

/**
 * @route   POST /api/oss-configs
 * @desc    创建OSS配置
 * @access  Private
 */
router.post('/', OssConfigController.create);

/**
 * @route   PUT /api/oss-configs/:id
 * @desc    更新OSS配置
 * @access  Private
 */
router.put('/:id', OssConfigController.update);

/**
 * @route   DELETE /api/oss-configs/:id
 * @desc    删除OSS配置
 * @access  Private
 */
router.del('/:id', OssConfigController.delete);

export default router;

